package com.mr.dao.entity.product;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import com.mr.constants.Tables;
import com.mr.dao.entity.BaseEntity;
import com.mr.dao.entity.customer.OrderedSubproduct;
import com.mr.dao.entity.customer.Promo;
import com.mr.dao.entity.customer.TmpOrderedSubproduct;

/**
 * @author Alex
 */
@Entity(name = Tables.SUBPRODUCT)
public class Subproduct extends BaseEntity {
	private static final long serialVersionUID = 1457204243474536999L;
	private String name;
	private BigDecimal regular_price;
	private BigDecimal sale_price;
	private String last_update;
	@ManyToOne
	private Product product;
	@OneToMany(mappedBy = "subproduct", cascade = CascadeType.ALL)
	private List<OrderedSubproduct> orderedSubproducts = new ArrayList<OrderedSubproduct>(0);
	@OneToMany(mappedBy = "subproduct", cascade = CascadeType.ALL)
	private List<TmpOrderedSubproduct> tmpOrderedSubproducts = new ArrayList<TmpOrderedSubproduct>(0);
	@OneToMany(mappedBy = "subproduct", cascade = CascadeType.ALL)
	private List<Promo> promos = new ArrayList<Promo>(0);

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public BigDecimal getRegular_price() {
		return regular_price;
	}

	public void setRegular_price(BigDecimal regular_price) {
		this.regular_price = regular_price;
	}

	public BigDecimal getSale_price() {
		return sale_price;
	}

	public void setSale_price(BigDecimal sale_price) {
		this.sale_price = sale_price;
	}

	public String getLast_update() {
		return last_update;
	}

	public void setLast_update(String last_update) {
		this.last_update = last_update;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public List<OrderedSubproduct> getOrderedSubproducts() {
		return orderedSubproducts;
	}

	public void setOrderedSubproducts(List<OrderedSubproduct> orderedSubproducts) {
		this.orderedSubproducts = orderedSubproducts;
	}

	public List<TmpOrderedSubproduct> getTmpOrderedSubproducts() {
		return tmpOrderedSubproducts;
	}

	public void setTmpOrderedSubproducts(List<TmpOrderedSubproduct> tmpOrderedSubproducts) {
		this.tmpOrderedSubproducts = tmpOrderedSubproducts;
	}

	public List<Promo> getPromos() {
		return promos;
	}

	public void setPromos(List<Promo> promos) {
		this.promos = promos;
	}

}
